#include <stdio.h>
#include <string.h>

#include <holt.h>

int main (void) {
    int fd;
    struct input_event ev;
    
    fd = holt_init(NULL);
    if (fd < 0) {
        printf("Error %d initializing holt library: %s\n", -fd, strerror(-fd));
        return fd;
    }
    
    do {
        holt_read_event(&ev);
        
        printf("Hevent type %u code %u value %d\n",
               ev.type, ev.code, ev.value);

        if (ev.type == EV_PWR) break; //unplugged

    } while ( !(ev.type == EV_KEY && ev.code == KEY_PHONE && ev.value == 0) );
        
    holt_deinit();
    return 0;
}
